package net.jueb.springStudy.ribbon;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

//在注册中心中进行注册
@EnableEurekaClient
//启动服务发现的功能，开启了才能调用其它服务
@EnableDiscoveryClient
//熔断机制断路器支持
@EnableHystrix
@SpringBootApplication
public class SpringRibbonApplication {

	public static void main(String[] args) {
		SpringApplication.run(SpringRibbonApplication.class, args);
	}

    @Bean
    //注册表明，这个restRemplate是需要做负载均衡的。
    @LoadBalanced
    RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
